package it.irondev.appturismo.dao;

import it.irondev.appturismo.dao.example.DifficultyExample;
import it.irondev.appturismo.entity.Difficulty;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface DifficultyMapper {
    @SelectProvider(type=DifficultySqlProvider.class, method="countByExample")
    int countByExample(DifficultyExample example);

    @DeleteProvider(type=DifficultySqlProvider.class, method="deleteByExample")
    int deleteByExample(DifficultyExample example);

    @Delete({
        "delete from Difficulty",
        "where idDifficulty = #{iddifficulty,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer iddifficulty);

    @Insert({
        "insert into Difficulty (idDifficulty, name)",
        "values (#{iddifficulty,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR})"
    })
    int insert(Difficulty record);

    @InsertProvider(type=DifficultySqlProvider.class, method="insertSelective")
    int insertSelective(Difficulty record);

    @SelectProvider(type=DifficultySqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="idDifficulty", property="iddifficulty", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR)
    })
    List<Difficulty> selectByExample(DifficultyExample example);

    @Select({
        "select",
        "idDifficulty, name",
        "from Difficulty",
        "where idDifficulty = #{iddifficulty,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="idDifficulty", property="iddifficulty", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR)
    })
    Difficulty selectByPrimaryKey(Integer iddifficulty);

    @UpdateProvider(type=DifficultySqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Difficulty record, @Param("example") DifficultyExample example);

    @UpdateProvider(type=DifficultySqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Difficulty record, @Param("example") DifficultyExample example);

    @UpdateProvider(type=DifficultySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Difficulty record);

    @Update({
        "update Difficulty",
        "set name = #{name,jdbcType=VARCHAR}",
        "where idDifficulty = #{iddifficulty,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Difficulty record);
}